# 导入Kivy模块
from kivy.app import App
from kivy.core.text import LabelBase, DEFAULT_FONT
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang.builder import Builder

LabelBase.register(DEFAULT_FONT, "../resources/font/simkai.ttf")

# 创建登录页面类
class LoginPage(Screen):
    print("login page")
    def verify_credentials(self):
        user_name = self.ids["user_name"].text
        password = self.ids["password"].text
        print(f"user_name:{user_name} password:{password}")
        if user_name and password == "111111":
            self.manager.current = "main"

# 创建用户页面类
class MainPage(Screen):
    print("main page")
    pass

# 创建屏幕管理器类
class ScreenManagement(ScreenManager):
    print("ScreenManager")
    pass

# 从kv文件加载布局
kv_file = Builder.load_file('3-登录页面一.kv')

# 创建Kivy应用程序类
class LoginApp(App):
    def build(self):
        return kv_file

# 运行应用程序
if __name__ == '__main__':
    LoginApp().run()